Fix Xen patches to Linux so that they use pfn_pte() and
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 18 Aug 2005 15:01:03 +0000 (15:01 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 18 Aug 2005 15:01:03 +0000 (15:01 +0000)
pfn_pte_ma() constructors, rather than splicing together
ptes manually. Not only is this cleaner, it also ensures
that the NX/XD bit is safely masked off on systems that do
not support it.

Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c

index 381e8e2591fdc388228a20b299b3e362a8b149f6..26433a2b67e21f93140ae67c99787d88ea380ee7 100644 (file)
@@ -348,7 +348,7 @@ void xen_create_contiguous_region(unsigned long vstart, unsigned int order)
        for (i = 0; i < (1<<order); i++) {
                BUG_ON(HYPERVISOR_update_va_mapping(
                        vstart + (i*PAGE_SIZE),
-                       __pte_ma(((mfn+i)<<PAGE_SHIFT)|__PAGE_KERNEL), 0));
+                       pfn_pte_ma(mfn+i, PAGE_KERNEL), 0));
                xen_machphys_update(mfn+i, (__pa(vstart)>>PAGE_SHIFT)+i);
                phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn+i;
        }
@@ -395,7 +395,7 @@ void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order)
                        MEMOP_increase_reservation, &mfn, 1, 0) != 1);
                BUG_ON(HYPERVISOR_update_va_mapping(
                        vstart + (i*PAGE_SIZE),
-                       __pte_ma((mfn<<PAGE_SHIFT)|__PAGE_KERNEL), 0));
+                       pfn_pte_ma(mfn, PAGE_KERNEL), 0));
                xen_machphys_update(mfn, (__pa(vstart)>>PAGE_SHIFT)+i);
                phys_to_machine_mapping[(__pa(vstart)>>PAGE_SHIFT)+i] = mfn;
        }
index bf717a86328c9d103e00c046bb610267c9de628f..ed4822932f69e1da0b9cffaac8cf5039e6210e8a 100644 (file)
@@ -213,9 +213,7 @@ static void balloon_process(void *unused)
             {
                 BUG_ON(HYPERVISOR_update_va_mapping(
                     (unsigned long)__va(pfn << PAGE_SHIFT),
-                    __pte_ma((mfn_list[i] << PAGE_SHIFT) |
-                             pgprot_val(PAGE_KERNEL)),
-                    0));
+                    pfn_pte_ma(mfn_list[i], PAGE_KERNEL), 0));
             }
 
             /* Finally, relinquish the memory back to the system allocator. */
index eb26470286f609f8e5fd07f943f6f32abaa6c54b..c4be747c2331107a01d5078e69cab89603d5ac02 100644 (file)
@@ -406,21 +406,15 @@ static void dispatch_probe(blkif_t *blkif, blkif_request_t *req)
 #endif
 
 
-#ifdef CONFIG_XEN_BLKDEV_TAP_BE
     if ( HYPERVISOR_update_va_mapping_otherdomain(
         MMAP_VADDR(pending_idx, 0),
-        (pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL },
+        pfn_pte_ma(req->frame_and_sects[0] >> PAGE_SHIFT, PAGE_KERNEL),
+#ifdef CONFIG_XEN_BLKDEV_TAP_BE
         0, (blkif->is_blktap ? ID_TO_DOM(req->id) : blkif->domid) ) )
-        
-        goto out;
 #else
-    if ( HYPERVISOR_update_va_mapping_otherdomain(
-        MMAP_VADDR(pending_idx, 0),
-        (pte_t) { (req->frame_and_sects[0] & PAGE_MASK) | __PAGE_KERNEL },
-        0, blkif->domid) ) 
-        
-        goto out;
+        0, blkif->domid) )
 #endif
+        goto out;
 #endif /* endif CONFIG_XEN_BLKDEV_GRANT */
    
     rsp = vbd_probe(blkif, (vdisk_t *)MMAP_VADDR(pending_idx, 0),